<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户注册</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .box {
            width: 200px;
            height: 160px;
            background-color: pink;
        }
    </style>
</head>

<body>
    <div class="box">
        <form action="#" onsubmit="return false">
            <label for="account">账号：</label>
            <input type="text" name="account" id="account">
            <label for="account">密码：</label>
            <input type="password" name="password" id="password">
            <button type="submit">
                登录    
            </button>
            <button type="button">
                注册
            </button>
        </form>
    </div>
</body>
<script src="/admin/assets/js/jquery-3.5.1.min.js"></script>
<script>
    // 用户登录
    $('form').on('submit', function () {
        let user = {};
        $.ajax({
            url: '/user.do/login',
            type: 'post',
            async: false,
            data: {
                accout: $('#account').val(),
                password: $('#password').val(),
            },
            success: function (res) {
                console.log(res);
                user = res.data;
            },
            error:function(res){
                console.log(res);
            }
        })
        return user;
    })
</script>

</html>